AMD/IOMMU: Treat guest head/tail pointers as byte offsets
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 3 Feb 2020 13:50:34 +0000 (13:50 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 10 Feb 2020 16:14:17 +0000 (16:14 +0000)
commit40bc1b0c1995cfac0d0da7b9069e944392dafc14
treead5de26471975233c9e5e5357d5e3d43a1d160a9
parent127b5050e5fc5455e84589bcac25c5985795f009
AMD/IOMMU: Treat guest head/tail pointers as byte offsets

The MMIO registers as already formatted as byte offsets.  Start by masking out
reserved bits, which fixes an implementation bug (reserved bits should be
read-only zero, rather than preserving their previously-written value).  As a
consequence, we can use the values directly, instead of masking/shifting on
every use.

Store the buffer size, rather than the number of entries, to keep the same
units for comparison purposes.

This simplifies guest_iommu_get_table_mfn() by dropping the entry_size
parameter, and simplifies the map_domain_page() handling by being able to drop
the log_base variables.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/passthrough/amd/iommu.h
xen/drivers/passthrough/amd/iommu_guest.c